{include file="public/layout" /}
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;min-width:auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="row-bar clearfix mb10">
        <div class="row-bar-l fl">
            <ul class="tab-base nc-row">
                {eq name="$Think.const.CONTROLLER_NAME.'@index'|is_check_access" value="1"}
                    <li><a href="{:url('Weapp/index')}" class="tab {eq name="$Request.action" value="index"}current{/eq}"><span>系统应用</span></a></li>
                {/eq}
                
                <!-- {eq name="$Think.const.CONTROLLER_NAME.'@plugin'|is_check_access" value="1"}
                    {eq name="$weapp_plugin_open" value="1"}
                    <li><a href="{:url('Weapp/plugin')}" class="tab {eq name="$Request.action" value="plugin"}current{/eq}"><span>云应用</span></a></li>
                    {/eq}
                {/eq} -->
            </ul>
        </div>
        <div class="flexigrid fr">
            <form class="navbar-form form-inline" id="searchForm" action="{:url('Weapp/index')}" method="get" onsubmit="layer_loading('正在处理');">
                {$searchform.hidden|default=''}
                <div class="ftitle">
                    <div class="sDiv2 fl" style="margin-right: 6px;">
                        <input type="text" size="30" name="keywords" value="{$Request.param.keywords}" class="qsbox" placeholder="搜索应用名称...">
                        <input type="submit" class="btn" value="搜索">
                        <i class="iconfont e-sousuo"></i>
                    </div>
                </div>
            </form>
        </div>
    </div>
    {volist name="$weapp_group_arr" id="group_info"}
        {if condition="!empty($list_group[$group_info['id']])"}
        <div class="on-off_panel" id="list_group_{$group_info['id']}" style="margin-bottom: 0; display: none;">
            <div class="title">{$group_info['title']|default=''}</div>
            <div class="on-off_list">
                <div class="on-off_list b-icon">
                    <ul class="marketing-nav">
                    {volist name="$list_group[$group_info['id']]" id="vo"}
                        {notempty name="$vo.is_system"}
                            {if condition="!isset($nusetcodelist[$vo['code']])"}
                            <li class="more_li">
                                <a href="{$vo['config']['management']['href']}" target="{$vo['config']['management']['target']|default='_self'}">
                                    <div class="icon" style="background-color: {$group_info['bgcolor']};">
                                        <i class="{$vo.config.litpic|default='iconfont e-chajian'}"></i>
                                    </div>
                                    <span>
                                        <h2>{$vo['name']}</h2>
                                        <br>
                                        <p>{$vo.config.description|default='暂无描述~'}</p>
                                    </span>
                                </a>
                            </li>
                            {/if}
                        {else /}
                            <li class="more_li">
                                <a href="{$vo['config']['management']['href']}" {$vo['config']['management']['event']|default=''} target="{$vo['config']['management']['target']|default='_self'}" data-id="{$vo['id']}" data-code="{$vo['code']}" data-min_version="{$vo['config']['min_version']}" data-is_buy="{$vo['is_buy']}">
                                    <img src="{$vo.config.litpic}" width="56" height="56">
                                    <span>
                                        <h2>{$vo['name']}</h2>
                                        <br>
                                        <p>{$vo.config.description|default='暂无描述~'}</p>
                                    </span>
                                </a>
                            </li>
                        {/notempty}
                    {/volist}
                    </ul>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            if ($("#list_group_{$group_info['id']}").find('ul.marketing-nav li').length > 0) {
                $("#list_group_{$group_info['id']}").show();
            }
        </script>
        {/if}
    {/volist}
</div>
<form name="form2" id="form2" method="post" action="">
    <input type="hidden" name="id" value="" />
    <input type="hidden" name="code" value=""/>
    <input type="hidden" name="min_version" value=""/>
    <input type="hidden" name="thorough" value="1" />
</form>
<script type="text/javascript">

    $(function(){
        $(document).keydown(function(event){
            if (event.keyCode ==13) {
                $('#searchForm input[type=text]').each(function(index, item){
                    if ($(item).is(':focus')) {
                        $('#searchForm').submit();
                    }
                });
            }
        });
    });

    function install(obj)
    {
        //询问框
        var confirm = layer.confirm('还没安装该应用，确认安装？', {
                shade: layer_shade,
                area: ['480px', '190px'],   
                move: false,
                title: '提示',
                btnAlign:'r',
                closeBtn: 3,
                btn: ['确定', '取消'] ,//按钮
                success: function () {
                      $(".layui-layer-content").css('text-align', 'left');
                  }
            }, function(){
                layer.close(confirm);
                var is_buy = $(obj).attr('data-is_buy');
                if (0 == is_buy) {
                    var id = $(obj).attr('data-id');
                    var form2 = $('#form2');
                    form2.find('input[name=id]').val(id);
                    var url = "{:url('Weapp/install')}";
                    form2.attr('action', url);
                    layer_loading('正在处理');
                    form2.submit();
                } else {
                    var code = $(obj).attr('data-code');
                    var min_version = $(obj).attr('data-min_version');
                    var form2 = $('#form2');
                    form2.find('input[name=code]').val(code);
                    form2.find('input[name=min_version]').val(min_version);
                    var url = "{:url('Weapp/remoteInstall')}";
                    form2.attr('action', url);
                    layer_loading('远程安装');
                    form2.submit();
                }
            }, function(){
                layer.close(confirm);
            }
        );
        
        return false;
    }
</script>

{include file="public/footer" /}
